<template>
  <div>
    <a-button style="margin-right:10px;" @click="$refs.student.showModel()">选择学员</a-button>
    <div class="student-info" v-if="studentInfo.name">
      <a-tag color="pink" style="margin:0 8px;">在读</a-tag>
      <span class="name">{{studentInfo.name}}</span>
      <a-icon type="man" class="man" v-if="studentInfo.sex==0" />
      <a-icon type="woman" class="man" v-if="studentInfo.sex==1" />
      <span
        class="phone"
      >{{studentInfo.main_phone}}({{studentInfo.main_parent_type==1?'本人':studentInfo.main_parent_type==2?'妈妈':studentInfo.main_parent_type==3?'爸爸':studentInfo.main_parent_type==4?'爷爷':studentInfo.main_parent_type==5?'奶奶':studentInfo.main_parent_type==6?'外公':studentInfo.main_parent_type==7?'外婆':'未知'}})</span>
      <div class="course" v-if="studentInfo.couserInfo.course_num">
        <img src="~@/assets/apply/ke.png" alt />
      </div>
      <span class="text" v-if="studentInfo.couserInfo.course_num">报读课程：{{studentInfo.couserInfo.course_num}}</span>
      <div class="course" v-if="studentInfo.couserInfo.price">
        <img src="~@/assets/apply/qian.png" alt />
      </div>
      <span class="text" v-if="studentInfo.couserInfo.price">消费金额：{{studentInfo.couserInfo.price}}</span>
      <div class="course" v-if="studentInfo.couserInfo.exceed.sum_exceed_hour!==null&&studentInfo.couserInfo.exceed.sum_exceed_time!=null">
        <img src="~@/assets/apply/chao.png" alt />
      </div>
      <div style="display: flex;align-items: center;">
        <span
          class="text"
          v-if="studentInfo.couserInfo.exceed.sum_exceed_hour!==null"
        >超上{{studentInfo.couserInfo.exceed.sum_exceed_hour}}课时</span>
        <span
          class="text"
          v-if="studentInfo.couserInfo.exceed.sum_exceed_time!=null"
        >超上{{studentInfo.couserInfo.exceed.sum_exceed_time}}天数</span>
        <a-icon type="question-circle" style="margin-left: -16px;font-size: 14px;cursor: pointer;"  v-if="studentInfo.couserInfo.exceed.sum_exceed_time!=null"/>
      </div>
    </div>
    <return-model ref="student" @reload="studentModelReturnData" :studentType="1" :projectType="projectType"></return-model>
  </div>
</template>

<script>
import { studentList } from '@/api/student'

import returnModel from '@/components/returnModel'
export default {
  components: {
    returnModel,
  },
  props:{
    projectType:{
      type:Number,
      default:1
    }
  },
  data() {
    return {
      students: [],
      student_id: undefined,
      studentInfo: {
        couserInfo:{}
      },
    }
  },
  // created(){
  //   if(this.studentInfos){
  //     this.studentInfo=this.studentInfos
  //   }
  // },
  methods: {
    studentModelReturnData(e) {
      let params = JSON.parse(JSON.stringify(e))
      this.studentInfo = params
      console.log(this.studentInfo.couserInfo, 'ssssssss')
      this.$emit('getStudent', this.studentInfo)
    },
  },
}
</script>

<style scoped lang="less">
.student-info {
  margin-top: 8px;
  height: 36px;
  line-height: 36px;
  border: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  .name {
    font-size: 16px;
    color: #333;
    margin-right: 8px;
  }
  .man {
    color: #20a1ff;
    font-size: 14px;
    margin-right: 8px;
  }
  .phone {
    font-size: 14px;
    color: #666;
    margin-right: 8px;
  }
  .course {
    padding: 0 0 0 24px;
    border-left: 1px solid #e8e8e8;
    height: 20px;
    display: flex;
    align-items: center;
    margin-right: 8px;
    // div {
    //   width: 20px;
    //   height: 20px;
    //   line-height: 20px;
    //   text-align: center;
    //   color: #3bbdaa;
    //   border-radius: 3px;
    //   border: 1px solid #3bbdaa;
    //   font-size: 12px;
    // }
  }
  .text {
    color: #666;
    font-size: 14px;
    margin-right: 24px;
  }
}
</style>